
/*Mock.mock( rurl?, rtype?, template|function( options ) )*/
function mock (url, callback, config) {
    config && Mock.setup(config);
    Mock.mock(url, function (options) {
        var op = {
            get: function () {
                var params = options.url.split('?')[1].split('&').reduce(function (previousValue, currentValue) {
                    var arr = currentValue.split('=');
                    previousValue[arr[0]] = arr[1];
                    return previousValue;
                }, {});
                options.method = options.type;
                options.url = options.url.split('?')[0];
                options.params = params;
                delete options.type;
                delete options.body;
            },
            post: function () {
                var body = options.body.split('&').reduce(function (previousValue, currentValue) {
                    var arr = currentValue.split('=');
                    previousValue[arr[0]] = arr[1];
                    return previousValue;
                }, {});
                options.method = options.type;
                options.body = body;
                delete options.type;
            }
        };
        op[options.type.toLowerCase()]();
        return callback.call(Mock, options);
    })
}